﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Godot.modules.gdscript
{
    public abstract partial class GDTokenizer
    { 
        public enum Token
        {
            TK_EMPTY,
            TK_IDENTIFIER,
            TK_CONSTANT,
            TK_SELF,
            TK_BUILT_IN_TYPE,
            TK_BUILT_IN_FUNC,
            TK_OP_IN,
            TK_OP_EQUAL,
            TK_OP_NOT_EQUAL,
            TK_OP_LESS,
            TK_OP_LESS_EQUAL,
            TK_OP_GREATER,
            TK_OP_GREATER_EQUAL,
            TK_OP_AND,
            TK_OP_OR,
            TK_OP_NOT,
            TK_OP_ADD,
            TK_OP_SUB,
            TK_OP_MUL,
            TK_OP_DIV,
            TK_OP_MOD,
            TK_OP_SHIFT_LEFT,
            TK_OP_SHIFT_RIGHT,
            TK_OP_ASSIGN,
            TK_OP_ASSIGN_ADD,
            TK_OP_ASSIGN_SUB,
            TK_OP_ASSIGN_MUL,
            TK_OP_ASSIGN_DIV,
            TK_OP_ASSIGN_MOD,
            TK_OP_ASSIGN_SHIFT_LEFT,
            TK_OP_ASSIGN_SHIFT_RIGHT,
            TK_OP_ASSIGN_BIT_AND,
            TK_OP_ASSIGN_BIT_OR,
            TK_OP_ASSIGN_BIT_XOR,
            TK_OP_BIT_AND,
            TK_OP_BIT_OR,
            TK_OP_BIT_XOR,
            TK_OP_BIT_INVERT,
            //TK_OP_PLUS_PLUS,
            //TK_OP_MINUS_MINUS,
            TK_CF_IF,
            TK_CF_ELIF,
            TK_CF_ELSE,
            TK_CF_FOR,
            TK_CF_DO,
            TK_CF_WHILE,
            TK_CF_SWITCH,
            TK_CF_CASE,
            TK_CF_BREAK,
            TK_CF_CONTINUE,
            TK_CF_PASS,
            TK_CF_RETURN,
            TK_PR_FUNCTION,
            TK_PR_CLASS,
            TK_PR_EXTENDS,
            TK_PR_TOOL,
            TK_PR_STATIC,
            TK_PR_EXPORT,
            TK_PR_CONST,
            TK_PR_VAR,
            TK_PR_PRELOAD,
            TK_PR_ASSERT,
            TK_BRACKET_OPEN,
            TK_BRACKET_CLOSE,
            TK_CURLY_BRACKET_OPEN,
            TK_CURLY_BRACKET_CLOSE,
            TK_PARENTHESIS_OPEN,
            TK_PARENTHESIS_CLOSE,
            TK_COMMA,
            TK_SEMICOLON,
            TK_PERIOD,
            TK_QUESTION_MARK,
            TK_COLON,
            TK_NEWLINE,
            TK_ERROR,
            TK_EOF,
            TK_MAX
        }

        protected static String[] token_names =
        #region ____token_names____
        {
            "Empty",
            "Identifier",
            "Constant",
            "Self",
            "Built-In Type",
            "Built-In Func",
            "In",
            "'=='",
            "'!='",
            "'<'",
            "'<='",
            "'>'",
            "'>='",
            "'and'",
            "'or'",
            "'not'",
            "'+'",
            "'-'",
            "'*'",
            "'/'",
            "'%'",
            "'<<'",
            "'>>'",
            "'='",
            "'+='",
            "'-='",
            "'*='",
            "'/='",
            "'%='",
            "'<<='",
            "'>>='",
            "'&='",
            "'|='",
            "'^='",
            "'&'",
            "'|'",
            "'^'",
            "'~'",
            //"Plus Plus",
            //"Minus Minus",
            "if",
            "elif",
            "else",
            "for",
            "do",
            "while",
            "switch",
            "case",
            "break",
            "continue",
            "pass",
            "return",
            "func",
            "class",
            "extends",
            "tool",
            "static",
            "export",
            "const",
            "var",
            "preload",
            "assert",
            "'['",
            "']'",
            "'{'",
            "'}'",
            "'('",
            "')'",
            "','",
            "';'",
            "'.'",
            "'?'",
            "':'",
            "'\\n'",
            "Error",
            "EOF"
        };
        #endregion

        public static String get_token_name(Token p_token)
        {
            if (!Enum.IsDefined(typeof(Token), p_token) || p_token.Equals(Token.TK_MAX))
                return "";

            return token_names[(int)p_token];
        }
    }
}
